package junior.db.dao;

import junior.db.dao.base.IBaseId;
import junior.db.dao.mybatis.base.BaseMapper;
import junior.db.dao.mybatis.mapper.EntityMapper;
import junior.db.dao.update.BatchInsertOption;
import junior.db.dao.update.BatchUpdateOption;
import junior.db.dao.update.BatchUpsertOption;
import junior.db.dao.update.DeleteOption;
import junior.db.dao.update.InsertOption;
import junior.db.dao.update.UpdateFieldOption;
import junior.db.dao.update.UpdateOption;
import junior.db.dao.update.UpsertOption;

import java.util.List;

/**
 * @author wubo
 * @date 2024/9/6 14:09
 */
class MybatisMapperImpl<E extends IBaseId, ID> extends MybatisSelectMapperImpl<E> implements BaseMapper<E, ID> {
    
    public MybatisMapperImpl(EntityMapper entityMapper, Class<E> entityClass, Class<ID> idClass) {
        super(entityMapper, entityClass);
    }
    
    @Override
    public int insert(E entity, InsertOption option) {
        return entityMapper.insert(entity, option);
    }
    
    @Override
    public int batchInsert(List<E> entities, BatchInsertOption option) {
        return entityMapper.batchInsert(entities, option);
    }
    
    @Override
    public int upsert(E entity, UpsertOption option) {
        return entityMapper.upsert(entity, option);
    }
    
    @Override
    public int batchUpsert(List<E> entities, BatchUpsertOption option) {
        return entityMapper.batchUpsert(entities, option);
    }
    
    @Override
    public int update(E entity, UpdateOption option) {
        return entityMapper.update(entity, option);
    }
    
    @Override
    public int batchUpdate(List<E> entities, BatchUpdateOption option) {
        return entityMapper.batchUpdate(entities, option);
    }
    
    @Override
    public int updateField(UpdateFieldOption option) {
        return entityMapper.updateField(entityClass, option);
    }
    
    @Override
    public int delete(DeleteOption option) {
        return entityMapper.delete(entityClass, option);
    }
}
